<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Admincms extends CI_Controller {

function __construct()
    {
        parent::__construct();
    	$this->load->library('session');
		$this->load->helper('url');
		$this->load->database("centermod");
    	//$this->load->model("cmsmodel");
	}
	

		
		
	
 function page_newcostumer()
	{
		if($this->session->userdata("user")==false)
		{
		 		 $this->load->view("login");
			
		}else
			{
			$iduser=$session=$this->session->userdata("id");
			$nameuser=$this->session->userdata("user");
			$data=array('userid'=>$iduser,"nameuser"=>$nameuser);
			$this->load->view("newcostumer",$data);
				
		}


	}//adimin_hotel
	

	

	
function  loginout()
	{
		$info=array("id"=>"","user"=>"");
		$this->session->unset_userdata($info);
		$this->load->view("login");
	}
	
	
//############## function for enregistrement costumer information###################
function addinfor_hotel()
	{
		if($this->session->userdata("user")==false)
		{
		 		 $this->load->view("login");
			
		}else{
				
				 $idhotel=$this->input->get_post("idhotel"); 
				 $hotelname=$this->input->get_post("h_hotelname"); 
				 $adress=$this->input->get_post("h_adress"); 
				 $email=$this->input->get_post("h_email"); 
				 $description=$this->input->get_post("h_description"); 
				 $description_en=$this->input->get_post("h_description_en"); 
				 $email=	$this->input->get_post("h_email"); 
				 $ssh=$this->input->get_post("h_link_pdf"); 
				 $fax=$this->input->get_post("h_fax"); 	
				 $map=	$this->input->get_post("h_map"); 
				 $tel_local=$this->input->get_post("h_tel_local"); 	
				 $website=$this->input->get_post("h_website"); 
				 $level=$this->input->get_post("h_level"); 
				 $postion=$this->input->get_post("h_position");
				 $postion_arr=explode(",",$postion);
				 
				 $data=array(
				 "hotelname"=>$hotelname, 
				 "adress"=>$adress, 
				 "email"=>$email,
				 "link_pdf"=>$ssh, 
				 "description"=>$description ,
				 "desc_en"=>$description_en, 
				 "fax"=>$fax ,	
				 "map"=>$map ,
				 "tel_local"=>$tel_local, 	
				 "website"=>$website ,
				 "level"=>$level,
				 "axe_x"=>$postion_arr[0],
				 "axe_y"=>$postion_arr[1]
				 );
				 $idinsert=$this->cmsmodel-> insertetemplate("hotel",$data);
				 $error="hotel information is saved!";
				
				 $this->page_admin_hotel($idinsert,$error);
		
		}
		}
	
//############### end function for enregistrement ##################################	
	
}//class
?>